package com.neteast.bustruck.db.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Update
import com.neteast.bustruck.db.entiys.LocalSaveInfo
import com.neteast.bustruck.db.entiys.TmTruckLoadForm
import com.neteast.bustruck.db.entiys.TruckInfo

@Dao
interface TruckLoadDao {


    @Query("SELECT * FROM truck_load")
    suspend fun getAllList():List<TmTruckLoadForm>?

    @Query("SELECT * FROM truck_load WHERE truck_load_id LIKE :truckId")
    suspend fun getTruckLoad(vararg truckId:String): TmTruckLoadForm?



    @Query("SELECT * FROM truck_load WHERE username LIKE :userName and daytime LIKE :dayTime")
    suspend fun getTruckLoadForTime( userName:String, dayTime:String): TmTruckLoadForm?


    @Query("SELECT * FROM truck_load WHERE username LIKE :userName  ORDER By update_time DESC")
    suspend fun getTruckLoadForUpdate( userName:String): List<TmTruckLoadForm>?


    @Query("SELECT * FROM truck_load WHERE truck_load_id LIKE :truck_id and isUpdate LIKE :isUpdata ORDER By update_time DESC")
    suspend fun getTruckLoadForIdUpdate( truck_id:String,  isUpdata:Boolean): List<TmTruckLoadForm>?





    @Insert
    suspend fun insertList( info: TmTruckLoadForm):Long


    @Update
    suspend fun updateLocalInfo(vararg info: TmTruckLoadForm) :Int


    @Delete

    suspend fun deleteAll(list:List<TmTruckLoadForm>):Int



    @Delete
    suspend fun deletebyId(vararg data:TmTruckLoadForm):Int


}